import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AssetInventoryRecordsVO, AssetInventoryRecordsForm, AssetInventoryRecordsQuery } from '@/api/business/assetInventoryRecords/types';

/**
 * 查询资产进库记录列表
 * @param query
 * @returns {*}
 */

export const listAssetInventoryRecords = (query?: AssetInventoryRecordsQuery): AxiosPromise<AssetInventoryRecordsVO[]> => {
  return request({
    url: '/business/assetInventoryRecords/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询资产进库记录详细
 * @param id
 */
export const getAssetInventoryRecords = (id: string | number): AxiosPromise<AssetInventoryRecordsVO> => {
  return request({
    url: '/business/assetInventoryRecords/' + id,
    method: 'get'
  });
};

/**
 * 新增资产进库记录
 * @param data
 */
export const addAssetInventoryRecords = (data: AssetInventoryRecordsForm) => {
  return request({
    url: '/business/assetInventoryRecords',
    method: 'post',
    data: data
  });
};

/**
 * 修改资产进库记录
 * @param data
 */
export const updateAssetInventoryRecords = (data: AssetInventoryRecordsForm) => {
  return request({
    url: '/business/assetInventoryRecords',
    method: 'put',
    data: data
  });
};

/**
 * 删除资产进库记录
 * @param id
 */
export const delAssetInventoryRecords = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/assetInventoryRecords/' + id,
    method: 'delete'
  });
};

/**
 * 查询名称列表
 */
export const getNameList = (query?: any) => {
  return request({
    url: '/business/assetInventoryRecords/getNameList',
    method: 'get',
    params: query
  });
 };

 export const generateOrderAddNumber = () => {
  return request({
    url: '/business/assetInventoryRecords/getOrderNumber',
    method: 'get'
  });
};
